package com.chendx.store.goods.controller;

import com.chendx.model.common.dtos.ResponseResult;
import com.chendx.model.goods.dto.PrefDto;
import com.chendx.store.api.goods.PrefControllerApi;
import com.chendx.store.goods.service.PrefService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by chendx on 2022/4/19.
 */
@RestController
@RequestMapping("/api/pref")
public class PrefController implements PrefControllerApi {

    @Autowired
    private PrefService prefService;

    @Override
    @PostMapping("/list")
    public ResponseResult findPage(@RequestBody PrefDto dto) {
        return prefService.findPage(dto);
    }

    @Override
    @GetMapping("/one/{id}")
    public ResponseResult one(@PathVariable("id") String id) {
        return prefService.findById(id);
    }

    @Override
    @GetMapping("/all")
    public ResponseResult findAll() {
        return prefService.findAll();
    }

    @Override
    @GetMapping("/oneByuser")
    public ResponseResult findByUsername() {
        return prefService.findByUsername();
    }
}
